package com.springboot.example.monitor;

import com.springboot.example.monitor.interceptor.HandlerInterceptor;
import com.springboot.example.monitor.interceptor.UserTestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 作者: guo yao
 * 日期: 2016年01月14日
 * 时间: 下午14:45
 *
 * 继承 WebMvcConfigurerAdapter类也可以
 */
@Configuration
public class WebConfigServer extends WebMvcConfigurationSupport {


    // 拦截器配置
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserTestInterceptor()).addPathPatterns("/index*//**");
        registry.addInterceptor(new HandlerInterceptor()).addPathPatterns("/index*//**");
    }

}
